<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .dv_container {
            width: 100%;
            height: 100vh;
            background-color: #f4f4f4;
        }

        .dv_container p {
            width: 50px;
            height: 50px;
            /* background-color: red; */
            float: left;
            margin: 0 5px;
        }

        .dv_container ul {
            width: 100%;
            height: 20px;
            display: flex;
            justify-content: space-around;
            list-style: none;
            /* border: 1px solid; */

        }

        .dv_container ul li {
            width: 15%;
            height: 100%;
            border: 1px solid;
            text-align: center;
        }

        .red {
            background-color: red;
        }

        .green {
            background-color: green;
        }

        .pink {
            background-color: pink;
        }
    </style>
</head>

<body>
    <div class="dv_container">
        <p class="red" onclick="onClickRed()"></p>
        <p class="green" onclick="onClickGreen()"></p>
        <p class="pink" onclick="onClickPink()"></p>
        <ul>
            <li>新闻</li>
            <li>娱乐</li>
            <li>体育</li>
            <li>电影</li>
            <li>音乐</li>
            <li>旅游</li>
        </ul>
    </div>
</body>
<script>
    var odv = document.querySelector(".dv_container")
    var oul = document.querySelector("ul")
    function onClickRed() {
        odv.style.backgroundColor = 'red'
        oul.style.backgroundColor = 'red'
    }
    function onClickGreen() {
        odv.style.backgroundColor = 'green'
        oul.style.backgroundColor = 'green'
    }
    function onClickPink() {
        odv.style.backgroundColor = 'pink'
        oul.style.backgroundColor = 'pink'
    }
</script>

</html>